package com.godme.jvm;

import sun.misc.Unsafe;

import java.lang.reflect.Field;

public class DirectBuffer {

    public static void main(String[] args) throws IllegalAccessException {
        long unit = 1024 * 1024;
        Field unsafeField = Unsafe.class.getDeclaredFields()[0];
        unsafeField.setAccessible(true);
        Unsafe unsafe = (Unsafe) unsafeField.get(null);
        while (true){
            unsafe.allocateMemory(unit);
        }
    }
}
